import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import {ethers} from 'hardhat';
import { MonkeyKing } from '../src/types';

async function getFactorys(addr :string ) {
    let monkeyKing = (await ethers.getContractAt("MonkeyKing",addr)) as MonkeyKing;

    // let res:string[];
    await monkeyKing.getArrtibutesFactory().then(
        (arrs)=>{
            console.log(arrs)
            for (let i=0;i<arrs.length;i++){
                console.log("工厂编号="+i);
                console.log("工厂地址="+arrs[i]);
                // res.push(arrs[i]);
            }
        }

    ).catch((err) => {
        console.error(err);
        process.exit(1);
    });
}

// deployMonkeyKing();
getFactorys(process.env.MONKEYKING as string);